import 'card_bean.dart';

class PlayerBean {
  int id; //下标值
  String address;
  String state;
  String name;
  int money;
  int bet;
  List<CardBean> hands = new List(); //手牌s:suited代表同花色的手牌，手牌o：offsuit代表不同花色的手牌
  List<String> handsList = new List(); //手牌范围
  //handsList.add()
  //AA组合
  //黑桃A,红心A
  //黑桃A,梅花A
  //黑桃A,方片A
  //红心A,A
  int pos;

  double winRate = 0.00; //胜率
  double drawRate = 0.00; //平局概率

  double winCount = 0; //赢的次数
  double drawCount = 0; //平局的次数
  int strength = 0; //牌力

  List<int> typeCountList = new List(10);

  void clearRecord() {
    winCount = 0;
    drawCount = 0;
    strength = 0;
    winRate = 0.00;
    drawRate = 0.00;
    for (int i = 0; i < typeCountList.length; i++) {
      typeCountList[i] = 0;
    }
  }

  void addTypeCount(int type) {
    typeCountList[type] =
        typeCountList[type] == null ? 1 : ++typeCountList[type];
  }

  String getHandsStr() {
    String handsStr = "";
    for (var card in hands) {
      if (handsStr.isEmpty) {
        handsStr = card.getValue();
      } else {
        handsStr += "," + card.getValue();
      }
    }
    return handsStr;
  }
}
